<template>
	<view class='addWay'>
		<view class='container'>
			<view class='wayIcon imgPublic'>
				<image src="https://wx.gdxixiashi.com/public/images/home/kabj@2x.png" mode="widthFix"></image>
			</view>
			<view class='form'>
				<view class='yinhangka'>
					<view class='line'>
						<view class='lineTit'>激活码</view>
						<view class='lineVal'><input type="text" v-model="number" placeholder="请输入激活码"></view>
					</view>
				</view>
			</view>
		</view>
		<view class='btns' @tap='activeCard'>立即激活</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				number:'',
			}
		},
		onLoad(){
			
		},
		onShow(){},
		onShareAppMessage() {
			return{
				title:'洗匣士~您的家居窗帘清洗助手',
				path:'/pages/home?spreadId=' + (uni.getStorageSync('userId')?uni.getStorageSync('userId'):''),
				imageUrl:getApp().globalData.imgDomain+'public/logo.png',
				desc:'手机下单 | 专员取送 | 生态环保 | 轻奢洗护',
			}
		},
		onShareTimeline() {
			return{
				title:'洗匣士~您的家居窗帘清洗助手',
				path:'/pages/home?spreadId=' + (uni.getStorageSync('userId')?uni.getStorageSync('userId'):''),
				imageUrl:getApp().globalData.imgDomain+'public/logo.png',
				desc:'手机下单 | 专员取送 | 生态环保 | 轻奢洗护',
			}
		},
		methods:{
			// 激活洗户卡
			activeCard(){
				if(!this.number){
					uni.showToast({
						title:'激活码不能为空',
						icon:"none"
					})
					return
				}
				this.tool.getData('User/checkcard',{
					memberId:uni.getStorageSync('userId')?uni.getStorageSync('userId'):'',
					number:this.number,
				}).then(res=>{
					console.log(res);
					if(res){
						uni.showToast({
							title:'成功激活',
							icon:"success"
						})
						setTimeout(()=>{
							this.tool.back();
						},1650)
					}
				}).catch(err=>{
					console.log(err);
				})
			}
		},
	}
</script>

<style lang="scss">
	.addWay{
		width: 100%;
		.container{
			width: 100%;
			background: white;
			padding:24upx 4%;
			box-sizing: border-box;
			.form{
				width: 100%;
				.line{
					padding: 25upx 0;
					border-bottom: 1px solid rgba($color: #000000, $alpha: 0.1);
					.lineTit{
						font-size: 13px;
						color: #959494;
						margin-bottom: 24upx;
					}
					.wayImg{
						width: 200upx;
						height: 200upx;
					}
				}
			}
			.wayIcon{
				width: 55%;
				margin: 30upx auto 50upx;
			}
		}
		.btns{
			width: 100%;
			position: fixed;
			left:0;
			bottom: 0;
			color: white;
			background: linear-gradient(#609ff8 0%, #1664ff 100%);
			border-radius: 5px;
			padding: 12px 0;
			text-align: center;
		}
	}
</style>
